package com.sunxiansheng.user.entity.page;

import java.util.Objects;

/**
 * Description: 分页请求的入参
 * @Author sun
 * @Create 2024-07-18 16:59:16
 * @Version 1.1
 */
public class PageInfo {

    private Integer pageNo = 1;
    private Integer pageSize = 20;

    public Integer getPageNo() {
        return (pageNo == null || pageNo < 1) ? 1 : pageNo;
    }

    public Integer getPageSize() {
        return (pageSize == null || pageSize < 1) ? 20 : pageSize;
    }

    public PageInfo setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
        return this;
    }

    public PageInfo setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
        return this;
    }

    @Override
    public int hashCode() {
        return Objects.hash(pageNo, pageSize);
    }

    @Override
    public String toString() {
        return "PageInfo{" +
                "pageNo=" + pageNo +
                ", pageSize=" + pageSize +
                '}';
    }
}
